package com.qf.job;

import org.apache.shardingsphere.elasticjob.api.ShardingContext;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * author:z
 * time:2021/12/24 17:30
 * description:
 */
@Component
public class MyJob implements SimpleJob {
    @Override
    public void execute(ShardingContext shardingContext) {
        int shardingItem = shardingContext.getShardingItem();
        switch (shardingItem){
            case 0:
                System.out.println(new Date()+"执行了0");break;
            case 1:
                System.out.println(new Date()+"执行了1");break;
            case 2:
                System.out.println(new Date()+"执行了2");break;
            case 3:
                System.out.println(new Date()+"执行了3");break;
            case 4:
                System.out.println(new Date()+"执行了4");break;
            default:
                System.out.println(new Date()+"执行了5");break;
        }
    }
}
